@extends('backend::layout')
@section('content')


    @component('backend::component.tpl_frame')
        @slot('page_title') 充值数据 @endslot

        @slot('tools_btn')
            @component('backend::component.form.button')
                @slot('title') 奖金池信息统计 @endslot
                @slot('elem') a @endslot
                @slot('btn') btn @endslot
                @slot('color') danger @endslot
                @slot('icon') hcl-bz-qh @endslot
                @slot('href') {{route('b_PlatStats_bonus_pools')}} @endslot
            @endcomponent
        @endslot

        @slot('icon') hcl-sell-map @endslot
        @slot('class') mt-3 @endslot
        @slot('body_content')
            <table class="table table-bordered table-striped tbody info-card">
                <tbody>
                <tr><td>累计充值金额</td><td>累计充值次数</td><td>今日充值金额</td><td>今日充值次数</td></tr>
                <tr>
                    <td>{{$rg_count['total_rg']}}</td><td>{{$rg_count['count_rg']}}</td>
                    <td>{{$rg_today['total_rg']}}</td><td>{{$rg_today['count_rg']}}</td>
                </tr>
                </tbody>
            </table>
            <div class="d-flex flex-nowrap" id="rg-chart" style="width: 100%;height: 400px;"></div>

            <table class="table table-bordered table-striped tbody">
                <tbody>
                <tr><td>总收入</td><td>总支出</td><td>总沉淀</td><td>拨比</td></tr>
                <tr>
                    <td>{{$rg_count['inData']}}</td><td>{{$rg_count['outData']}}</td>
                    <td>{{$rg_count['surplus']}}</td><td>{{$rg_count['out_rate']}}%</td>
                </tr>
                </tbody>
            </table>
            @if($list->isNotEmpty())
                <table class="table table-bordered table-striped tbody">
                    <tbody>
                    <tr><td>日期</td><td>总收入</td><td>总支出</td><td>总沉淀</td><td>拨比</td></tr>
                    @foreach($list as $item)
                    <tr>
                        <td>{{$item['e_date']}}</td> <td>{{$item['indata']}}</td><td>{{$item['outdata']}}</td>
                        <td>{{$item['surplus']}}</td><td>{{$item['out_rate']}}%</td>
                    </tr>
                    @endforeach
                    </tbody>
                </table>
            @endif
        @endslot
    @endcomponent

@endsection
@push('scripts')
    <script src="{{asset(config('view.plugin').'/chart/echart/echarts.min.js')}}"></script>
    <script>
        rgChart();

        function rgChart() {
            $.get("{{route('b_PlatStats_chartRgData')}}",function (response) {
                if(response.status){
                    var myChart = echarts.init(document.getElementById('rg-chart'));
                    option = {
                        tooltip: {
                            trigger: 'axis'
                        },
                        legend: {
                            data:['充值次数','充值金额']
                        },
                        xAxis: {
                            type: 'category',
                            data: response.data.dates
                        },
                        yAxis: {
                            type: 'value'
                        },
                        series: [{
                            name:'充值次数',
                            data: response.data.num,
                            type: 'line'
                        },{
                            name:'充值金额',
                            data: response.data.money,
                            type: 'line'
                        }]
                    };
                    myChart.setOption(option);
                }
            })
        }

    </script>
@endpush